/** file ChangePitch.cpp
    author belot.nicolas
*/

#include "ChangePitch.h"

namespace libtrckr {
	ChangePitch::ChangePitch(){
		c = Converter(1.,1024);
	}

	ChangePitch::ChangePitch(const ChangePitch& cp){
		c= cp.c;
	}

	ChangePitch::~ChangePitch(){

	}

	void ChangePitch::Tune(DynArray<double> conf){
		c.ratio(conf[0]);
	}

	Buffer& ChangePitch::apply(Buffer& b, int*size){
		c.inputsize(*size);
		c.outputsize(b.capacity());

		int retsize;
		Buffer b2(*size);
		for(uint i=0;i<*size;i++){
			b2[i]=b[i];
		}
		retsize=c.convert(b2,b);
		*size=retsize;
		return b;
	}

}
